package com.evan.wj.service;

import com.evan.wj.dao.MenuDao;
import com.evan.wj.pojo.Book;
import com.evan.wj.pojo.Menu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuService  {
    @Autowired
    MenuDao menuDao;

    public List<Menu> list(){
        Sort sort = Sort.by(Sort.Direction.DESC, "id");
        return menuDao.findAll(sort);
    }

    public List<Menu> findAllByParentIdIs(int keywords) {
        return menuDao.findAllByParentIdIs(keywords);
    }

    public List<Menu> findAllByParentIdIsAndTypeIs(int keywords,String status) {
        return menuDao.findAllByParentIdIsAndTypeIs(keywords, status);
    }
}
